home *** CD-ROM | disk | FTP | other *** search
- page 60,132
- .lfcond
- title "TRACE - Interrupt Tracer"
- subttl Introduction
- page
- code segment para public 'code'
- assume cs:code,ds:code
- public selvideo,selprint,print,print_hex,print_word,print_wordb
- public crlf,print_line,print_seg,print_edit,print_dec,table_print
- public feed,key,zap_hits,prt_sc
-
- extrn prt_base:word,trace_table:byte,trace_curr:word,ict_index:word
-
- public pick_ict,do_traces,do_enable,do_fcb,dump_buf,bin_to_bit
- public dump_rec,dump_before,dump_after,dump_flags,dump_fcb
- public dump_asciiz,ict_dump,disp_active
-
- extrn rec_sizes:word,interp:near
- extrn old_int_5:dword
-
- include b:trace1e.aic
-
- prt_flag db 0 ;flag: printer (1) or Screen (2)
- subttl Support routines - Printer & Screen I/O
- page
- ;*****************************************
- ;
- ; Select video for subsequent output
- ;
- ;*****************************************
-
- selvmsg db cr,lf,"TRACE output routed to CRT screen",cr,lf,"$"
- selvideo proc near
- mov prt_flag,0
- push dx
- mov dx,offset selvmsg
- call print_line
- pop dx
- ret
- selvideo endp
-
-
- ;*****************************************
- ;
- ; Select printer for subsequent output
- ;
- ;*****************************************
-
- selpmsg db cr,lf,"TRACE output routed to printer",cr,lf,"$"
- selpnomsg db cr,lf,"Printer not found",cr,lf,"$"
- selprint proc near
- push ax
- mov ax,prt_base ;do we have a printer?
- or al,ah
- jz selprint_no_printer
-
- push dx
- mov dx,offset selpmsg
- call print_line
- pop dx
- mov prt_flag,al ;al is non-zero if we do
- jmp selprint_exit
- selprint_no_printer:
- push dx
- mov dx,offset selpnomsg
- call print_line
- pop dx
- selprint_exit:
- pop ax
- ret
- selprint endp
-
- ;********************************************************
- ;
- ; Output AL to printer or screen, depending on prt_flag.
- ;
- ;********************************************************
-
- print proc near
- push dx
- push cx
- push bx
- push ax
-
- ; ----- See if it should go to printer
-
- test prt_flag,0ffh ;send it to printer?
- jnz print1 ;yes
-
- print0:
-
- ;
- ; Send char to video via INT 010H
- ;
-
- mov bl,1
- mov ah,14 ;"Write TTY" func
- int 010h
- clc ;show no I/O error
- jmp short print9
-
- print1:
-
- ;----- Send it to printer
-
- mov dx,prt_base ;get printer base I/O address
- inc dx ;up to status port
- mov ah,al ;save char in ah
- xor cx,cx ;init timeout ticker
-
- print2:
- in al,dx ;get status
- test al,080h ;is printer busy?
- jnz print5 ;no, proceed to send char
-
- ;
- ; We're not immediately ready. Some printers require more of a wait than
- ; the simple 64K loop found in CX. So here's a time waster that you may
- ; want to tailor to your printer.
- ;
-
- mov al,8 ;greatly extend timeout value
-
- print3:
- dec al
- jnz print3
-
- loop print2 ;wait for whole timeout
- stc ;set carry for timeout
- jmp short print9 ;and exit
-
- print5:
- dec dx ;down to data reg
- mov al,ah ;recover char to be sent
- out dx,al ;put it on data lines
- inc dx ;up to control port
- inc dx
- mov al,0dh ;set strobe low
- out dx,al
- mov al,0ch ;set strobe high again
- out dx,al
- clc ;show no error
-
- print9:
-
- ;
- ; At this point, CARRY is SET if we were going to the printer and had an
- ; I/O error.
- ;
-
- jnc print10 ;no error
- call selvideo ;error, so switch to video
- pop ax ;recover AL
- push ax
- jmp print0 ;go send it to video
-
- print10:
- pop ax
- pop bx
- pop cx
- pop dx
- ret
- print endp
-
- ;********************************************************
- ;
- ; Output binary AL as 2 hex digits
- ;
- ;********************************************************
-
- print_hex proc near
- push bx
- push ax
- mov bl,al ;isolate HO nibble
- shr bl,1
- shr bl,1
- shr bl,1
- shr bl,1
- and bx,0fh
- mov al,hextab[bx] ;xlit to hex char
- call print ;print 1st char
- pop ax
- push ax
- mov bl,al ;isolate LO nibble
- and bx,0fh
- mov al,hextab[bx] ;xlit to hex char
- call print ;print 2nd char
- pop ax
- pop bx
- ret
- print_hex endp
-
- hextab db '0123456789ABCDEF'
-
- ;********************************************************
- ;
- ; Output binary word AX as 4 hex digits
- ;
- ;********************************************************
-
- print_word proc near
- xchg ah,al ;get HO half to AL
- call print_hex ;print 1st 2 chars
- xchg ah,al ;get LO half back to AL
- call print_hex ;print 2nd 2 chars
- ret
- print_word endp
-
- ;********************************************************
- ;
- ; Output binary word AX as 4 hex digits, plus a blank
- ;
- ;********************************************************
-
- print_wordb proc near
- push ax
- call print_word
- mov al,' '
- call print
- pop ax
- ret
- print_wordb endp
-
- ;*****************************************
- ;
- ; Print CRLF.
- ;
- ;*****************************************
-
- crlf proc near
- push ax
- mov al,0dh
- call print
- mov al,0ah
- call print
- pop ax
- ret
- crlf endp
-
- ;*****************************************
- ;
- ; Print string at DS:DX, up to "$" character.
- ;
- ;*****************************************
-
- print_line proc near
- push si
- push ax
- cld ;forward!
- mov si,dx ;DS:SI = string
-
- print_line2:
- lodsb ;get next byte to print
- cmp al,'$' ;terminating char?
- jz print_line9 ;yes, exit
- call print ;print this char
- jmp print_line2 ;continue till "$"
-
- print_line9:
- pop ax
- pop si
- ret
- print_line endp
-
- ;*****************************************
- ;
- ; Print DX (HO), AX (LO) as xxxx:xxxx.
- ;
- ;*****************************************
-
- print_seg proc near
- push ax
- mov ax,dx ;get HO word first
- call print_word
- mov al,':' ;show seperator too
- call print
- pop ax ;recover LO word
- call print_word
- ret
- print_seg endp
-
- ;********************************************************************
- ;
- ; Print a line at [DX], edited.
- ;
- ; Line may contain Edit_xxxx escape characters, as defined above.
- ;
- ;********************************************************************
-
- print_edit proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov si,dx ;use DS:SI to read line
- cld ;forward!!!
-
- print_edit2:
- lodsb ;get next byte of line
- cmp al,Edit_Byte ;binary byte to expand?
- jnz print_edit3 ;no
- lodsb ;yes, get 8-bit value
- call print_hex ;print it as hex
-
- print_edit2b:
- mov al,'H' ;tack "H" for HEX after it
-
- print_edit2c:
- call print
- jmp print_edit2 ;go get next char
-
- print_edit3:
- cmp al,Edit_Word ;16-bit binary to expand?
- jnz print_edit4 ;no
- lodsw ;yes, get 16-bit word
- call print_word ;display as hex
- jmp print_edit2b ;follow with 'H' and continue
-
- print_edit4:
- cmp al,Edit_Call ;call another routine?
- jnz print_edit5 ;no
- lodsb ;yes, get AH argument
- mov bh,al ;save for a nano...
- lodsw ;get DX argument
- mov dx,ax
- lodsw ;get address to call
- mov cx,ax
- mov ah,bh ;recover AH argument to use
- push si ;save our precious SI
- call cx ;call the routine
- pop si
- jmp print_edit2 ;go get next char
-
- print_edit5:
- cmp al,Edit_Dec8 ;8-bit decimal value?
- jnz print_edit6 ;no
- lodsb ;yes, get 8-bit byte
- xor ah,ah ;clear HO byte
-
- print_edit5b:
- call print_dec ;print AX as decimal
- jmp print_edit2 ;go get next input char
-
- print_edit6:
- cmp al,Edit_Dec16 ;16-bit decimal value?
- jnz print_edit7 ;no
- lodsw ;yes, get 16-bit byte
- jmp print_edit5b ;print it and go get next char
-
- print_edit7:
- cmp al,Edit_End ;end of input string?
- jnz print_edit2c ;no, assume ASCII char and print it
-
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- print_edit endp
-
-
- ;**************************************************
- ;
- ; Print AX in decimal, suppressing leading zeroes
- ;
- ;**************************************************
-
- print_dec proc near
- push dx
- push cx
- push bx
- push ax
- mov cx,10 ;divisor
- xor dx,dx
- div cx ;DL=units, AX = answer
- mov bh,dl ;save units
- xor dx,dx
- div cx ;DL=tens, AX = answer
- mov bl,dl ;get tens
- or bx,03030h ;make into 2 ASCII digits
- mov word ptr dec_buf+3,bx
- div cl ;AH=hunds, AL = answer
- mov bh,ah ;save hundreds
- xor ah,ah
- div cl ;AH=thous, AL = ten_thousands
- mov bl,ah ;get thous
- or bx,03030h ;make into 2 ASCII digits
- mov word ptr dec_buf+1,bx
- or al,030h ;make ten-thousands into ASCII digit
- mov byte ptr dec_buf,al
-
- ;
- ; Now edit out leading zeroes by advancing BX to 1st non-zero
- ;
-
- mov bx,offset dec_buf
- mov cx,4 ;max # to suppress
-
- print_dec2:
- cmp byte ptr [bx],'0'
- jnz print_dec5 ;found non-zero, so exit
- inc bx ;up to next digit
- loop print_dec2
-
- print_dec5:
-
- ;
- ; All set. Print from [BX] on...
- ;
-
- mov dx,bx
- call print_line
- pop ax
- pop bx
- pop cx
- pop dx
- ret
- print_dec endp
-
- dec_buf db "99999$"
-
-
- ;********************************************************************
- ;
- ; Print one string from a table of possible strings.
- ;
- ; On entry: AH holds selector
- ; DX holds table address
- ;
- ; Each table entry is as follows:
- ;
- ; db <selector>,"string",<term>
- ;
- ; where:
- ; <selector> is 8-bit byte that is compared with AH. If it
- ; matches, then this string is printed.
- ;
- ; "string" is the string to be printed
- ;
- ; <term> is the terminating character, as follows:
- ;
- ; 00H : end of this string
- ; 80H : end of this string, and end of table too
- ;
- ; If no <selector> matches AH, then "????" is printed.
- ;
- ;********************************************************************
-
- table_print proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov si,dx ;use DS:SI to read table
- cld ;forward!!!
-
- table_print2:
- lodsb ;get next selector
- cmp al,ah ;does it match AH?
- jnz table_print5 ;no, skip to next one
-
- table_print3:
-
- ;
- ; We have found string to print. Output it until a terminator is found.
- ;
-
- lodsb ;get byte of string
- test al,07fh ;terminator?
- jz table_print9 ;yes, exit
- call print ;no, print this char
- jmp table_print3
-
- table_print5:
-
- ;
- ; Not this selector. Skip over string till terminator, then go peek
- ; at next selector.
- ;
-
- lodsb ;get byte of string
- test al,07fh ;terminator?
- jnz table_print5 ;no, keep skipping
-
- ;
- ; We have terminator at end of skipped string. It may be end of whole table...
- ;
-
- cmp al,080h ;end of table?
- jnz table_print2 ;no, go check next selector
- mov dx,offset huh ;yes, print "????" message cause match not found
- call print_line
-
- table_print9:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- table_print endp
-
- huh db "????$"
-
- ;*********************************************
- ;
- ; Issue extra linefeeds if we're going to the printer. This
- ; moves the paper up enough to be read.
- ;
- ; This should be called before any input, and whenever output is
- ; generally finished.
- ;
- ;*********************************************
-
- feed proc near
- push ax
- push cx
- test prt_flag,0ffh ;are we going to the printer?
- jz feed9 ;no, just exit
- mov cx,num_feeds ;# linefeeds to do
- jcxz feed9 ;none, so exit
-
- feed2:
- call crlf
- loop feed2
-
- feed9:
- pop cx
- pop ax
- ret
- feed endp
-
- subttl Menu Handling
- page
- ;*********************************************
- ;
- ; Get uppercase keyboard char to AL. AH is clobbered.
- ;
- ;*********************************************
-
- key proc near
- mov ah,0 ;use ROM BIOS to read keyboard
- int 016h
- cmp al,'a' ;lowercase char?
- jb key9 ;no
- cmp al,'z'
- ja key9 ;likewise no
- and al,0dfh ;yes, convert to uppercase
- key9:
- ret
- key endp
-
- ;*********************************************
- ;
- ; Reset all ICT hits to zero, and restart trace buffer
- ;
- ;*********************************************
- zapmsg db cr,lf,"Counters zeroed",cr,lf,"$"
-
- zap_hits proc near
- push si
- push ax
- push bx
- push cx
- mov cx,number_icts ;Number of ICT's
- xor si,si ;start with # 0
- cli ;no interrupts!
-
- zap_hits2:
- mov bx,ict_index[si] ;[BX] --> ICT
- mov [bx].ICT_hits,0
- add si,2 ;up to next ICT
- loop zap_hits2 ;till we've done all of them
-
- mov trace_curr,offset trace_table
- sti ;interrupts OK now
- push dx
- mov dx,offset zapmsg
- call print_line
- pop dx
- pop cx
- pop bx
- pop ax
- pop si
- ret
- zap_hits endp
-
- ;**********************************************
- ;
- ; Pick ICT's with which to do something.
- ;
- ; This is called to select ICT for various operations.
- ;
- ; On entry, DX holds address of question (no CRLF's) to be asked.
- ;
- ; Returns: CARRY SET if user selected ABORT to cancel the caller's operation
- ;
- ; CARRY CLEAR if AL has been set to 8-bit pattern, with each
- ; bit from 0 to 7 representing an ICT (0-7) that was selected.
- ;
- ;**********************************************
-
- pick_ict proc near
- push bx
- push cx
- push dx
- mov byte ptr pick_map,0 ;init to nobody selected
-
- pick_ict1:
-
- ;
- ; Put up our selection menu
- ;
-
- call crlf
- pop dx ;display caller's question
- push dx
- call print_line
- mov dx,offset pick_menu ;put up our menu
- call print_line
-
- ;
- ; Fill in choices already made, as if he had typed them
- ;
-
- mov cx,number_icts ;# ICT's
- mov ah,byte ptr pick_map ;AH has bitmap
- mov al,'0' ;AL holds ASCII '0' - '7'
-
- pick_ict1b:
- test ah,1 ;Is this ICT selected?
- jz pick_ict1c ;no
- call print ;yes, show corresponding ASCII char
-
- pick_ict1c:
- inc al ;Bump ASCII char
- shr ah,1 ;get next bit to test
- loop pick_ict1b ;till done all 8
- call feed ;eject paper on printer
-
- pick_ict2:
-
- ;
- ; Get and handle next keypress
- ;
-
- call key
- cmp al,'0' ;ICT number?
- jb pick_ict3 ;no
- cmp al,'7'
- ja pick_ict3 ;no
- call print ;yes, echo it
-
- ;
- ; Convert this ASCII char to bitmap bit, and add to our map
- ;
-
- call bin_to_bit ;comes back in AL
- or byte ptr pick_map,al ;add this new bit into pattern
- jmp pick_ict2 ;go get next keypress
-
- pick_ict3:
- cmp al,'L' ;List ICT's?
- jnz pick_ict4 ;no
- call disp_active ;yes, show all active ICT's
- jmp pick_ict1 ;give our menu again
-
- pick_ict4:
- cmp al,'R' ;Restart?
- jnz pick_ict5 ;no
- mov byte ptr pick_map,0 ;yes, clear map
- jmp pick_ict1 ;give new menu
-
- pick_ict5:
- cmp al,'G' ;Go with choices?
- jnz pick_ict6 ;no
-
- pick_ict5b:
- mov al,byte ptr pick_map ;yes, get choices as bitmap
- clc ;tell caller to use it
- jmp short pick_ict9 ;exit
-
- pick_ict6:
- cmp al,0dh ;Carriage Return?
- jz pick_ict5b ;yes, same as "Go"
- cmp al,'A' ;Abort operation?
- jnz pick_ict7 ;no
-
- pick_ict6b:
- stc ;tell caller to abort
- jmp short pick_ict9 ;exit
-
- pick_ict7:
- cmp al,1bh ;ESCAPE?
- jz pick_ict6b ;yes, same as "Abort"
-
- ; ------ Unknown choice
-
- jmp pick_ict2 ;go get next keypress
-
- pick_ict9:
- pop dx
- pop cx
- pop bx
- ret
- pick_ict endp
-
- pick_menu db 0dh,0ah
- db "0-7 picks ICT (L)ist ICT's (A)bort (R)estart (G)o with choices"
- db 0dh,0ah,":$"
-
- pick_map db 0 ;bitmap of selected ICT's
-
-
- ;*********************************************
- ;
- ; Handle "Traces" main menu option
- ;
- ;*********************************************
-
- do_traces proc near
- push ax
- push dx
- mov dx,offset trace_menu ;put up our menu
- call print_line
- call feed ;extra CRLF's for printer
- call key ;get his selection
- cmp al,'A' ;dump All?
- jnz do_traces2 ;no
- mov al,0ffh ;yes, get bitmap for all ICT's
- jmp short do_traces7 ;dump 'em
-
- do_traces2:
- cmp al,'S' ;Selected ICT's?
- jnz do_traces9 ;no, so exit
- mov dx,offset trace_prompt ;point to question to be used
- call pick_ict ;get ICT's as bitmap in AL
- jc do_traces9 ;user wants to forget about it
-
- do_traces7:
-
- ;
- ; Do dump, with AL holding bitmap of ICT's that are to be included
- ;
-
- call dump_buf ;with AL already set
-
- do_traces9:
- pop dx
- pop ax
- ret
- do_traces endp
-
- trace_menu db 0dh,0ah
- db "Display (A)ll or (S)elected ICTs' traces:$"
- trace_prompt db "Pick ICT's whose traces are to be included in dump$"
-
-
- ;*********************************************
- ;
- ; Set or Clear F_ENABLE.
- ;
- ; On entry, AL holds bit value for F_ENABLE (i.e. - ON or OFF).
- ;
- ; This routine asks user for ICT's to be enabled or disabled.
- ;
- ;*********************************************
-
- do_enable proc near
- push si
- push dx
- push cx
- push bx
- push ax ;push him last so we can get to him
-
- mov dx,offset enable_prompt ;Assume "Enable"
- test al,F_ENABLE ;are we enabling?
- jnz do_enable1 ;yes, we have right message
- mov dx,offset disable_prompt ;Use "Disable" message
-
- do_enable1:
- call pick_ict ;get ICT's to be affected
- jc do_enable9 ;user wants to forget it
- mov byte ptr enable_map,al ;save bitmap of ICT's to be done
- xor si,si ;start with ICT #0
- mov cx,number_icts ;number of ICT's to look at
-
- do_enable2:
- test byte ptr enable_map,1 ;Should this ICT be done?
- jz do_enable5 ;no
- mov bx,ict_index[si] ;yes, point to ICT
- cli ;*** NO INTERRUPTS!!! ***
- pop ax ;get F_ENABLE value
- push ax
- and al,F_ENABLE ;isolate our bit
- mov ah,[bx].ICT_flags ;get current flags value
- and ah,F_ENABLE XOR 0ffh ;turn off our bit
- or ah,al ;set it per caller's desire
- mov [bx].ICT_flags,ah ;replace it in ICT
- STI ;*** INTERRUPTS OK NOW ***
-
- do_enable5:
- add si,2 ;up to next ICT
- shr byte ptr enable_map,1 ;get next ICT's bitmap bit to Bit 0
- loop do_enable2 ;till we've looked at all ICT's
-
- do_enable9:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- do_enable endp
-
- enable_prompt db "Pick ICT's to have tracing ENABLED$"
- disable_prompt db "Pick ICT's to have tracing DISABLED$"
- enable_map db 0 ;bitmap of ICT's to be altered
-
-
-
-
- ;*********************************************
- ;
- ; Toggle F_FCB in some ICT's.
- ;
- ;*********************************************
-
- do_fcb proc near
- push si
- push dx
- push cx
- push bx
- push ax ;push him last so we can get to him
-
- mov dx,offset fcb_toggle
- call pick_ict ;get ICT's to be affected
- jc do_fcb9 ;user wants to forget it
- xor si,si ;start with ICT #0
- mov cx,number_icts ;number of ICT's to look at
-
- do_fcb2:
- test al,1 ;Should this ICT be done?
- jz do_fcb5 ;no
- mov bx,ict_index[si] ;yes, point to ICT
- xor [bx].ICT_flags,F_FCB ;toggle current setting
-
- do_fcb5:
- add si,2 ;up to next ICT
- shr al,1 ;get next ICT's bitmap bit to Bit 0
- loop do_fcb2 ;till we've looked at all ICT's
-
- do_fcb9:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- do_fcb endp
-
- fcb_toggle db "Pick ICT's to have F_FCB toggled$"
-
- subttl Reporting Routines
- page
- ;**************************************************
- ;
- ; Dump trace buffer for ICT's represented by bitmap in AL.
- ;
- ; If bit n in AL is set, then ICT n's trace records are to be included
- ; in dump.
- ;
- ;**************************************************
-
-
- dump_buf proc near
- push di
- push si
- push dx
- push cx
- push bx
- push ax ;push bitmap last so that we can get to it
- xor di,di ;di is printed line counter
- mov si,offset trace_table ;start at front of buf
-
- dump_buf2:
- cmp si,trace_curr ;done whole buffer?
- jae dump_buf9 ;yes, exit
-
- ;
- ; Let a keypress interrupt us
- ;
-
- mov ah,1 ;ROM BIOS "Check for keypress" func
- int 016h ;keypress present?
- jnz dump_buf9 ;yes, exit
-
- mov al,[si].B_type ;get ICT #
- call bin_to_bit ;convert to bitmap bit
- pop bx ;peek at caller's requested bitmap
- push bx
- and bl,al ;is this ICT included in caller's bitmap?
- jz dump_buf5 ;no, skip it
-
- ;
- ; See if it's time for title line
- ;
-
- test di,07h ;every 8 lines
- jnz dump_buf4 ;not time for title line
- mov dx,offset dump_title ;print title line
- call print_line
-
- dump_buf4:
- call dump_rec ;dump this record
- inc di ;bump # lines printed
-
- dump_buf5:
-
- ;
- ; Skip over this record, to next one. To do that, we need to know what
- ; type of record it is, so that we know how big a record
- ; we have to skip over.
- ;
-
- mov bl,[si].B_type ;get trace record type
- and bx,11110000b ;isolate type itself
- shr bx,1 ;develop type times 2
- shr bx,1
- shr bx,1
- add si,rec_sizes[bx] ;add record size to current pointer
- jmp dump_buf2 ;continue till buffer exhausted
-
- dump_buf9:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- pop di
- ret
- dump_buf endp
-
- dump_title db 0dh,0ah
- db 0dh,0ah
- db "INT # AX BX CX DX ES DS SI DI BP SS SP CS:IP"
- db 0dh,0ah
- db "--- -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---------$"
-
- ;***********************************************
- ;
- ; Given binary number (0-7) in AL, return bitmap in AL with corresponding
- ; bit (Bit 0 thru Bit 7) set.
- ;
- ; AH is zeroed.
- ;
- ;***********************************************
-
- bin_to_bit proc near
- mov ah,al ;AH is counter, from 7 to 0
- mov al,1 ;AL is bitmap, Bit 0 to Bit 7
- and ah,7 ;constrain input
- jz bin_to_bit9 ;binary was 0, so return with Bit 0 set
-
- bin_to_bit3:
- add al,al ;shift bitmap left 1 bit
- dec ah ;dec count by one
- jnz bin_to_bit3
-
- bin_to_bit9:
- ret
- bin_to_bit endp
-
- ;***********************************************
- ;
- ; Dump trace record at [SI]. This routine prints the common
- ; header information, then calls specific routines to expand
- ; details.
- ;
- ;***********************************************
-
- dump_rec proc near
- push si
- push dx
- push cx
- push bx
- push ax
-
- call crlf
- mov al,[si].B_int ;get Interrupt #
- call print_hex ;show interrupt #
- mov al,'H'
- call print
- mov al,' '
- call print
- mov al,[si].B_type ;get ICT #
- and al,0fh ;less than 15
- call print_hex ;show interrupt number
- mov al,' '
- call print ;print a space
- mov bl,[si].B_type ;get trace type
- and bx,11110000b ;isolate type of trace
- shr bx,1 ;develop type times 2
- shr bx,1
- shr bx,1
- mov bx,word ptr dump_table[bx]
- call bx ;call proper specific routine
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- dump_rec endp
-
- ;
- ; Table of routines to handle various record types
- ;
-
- dump_table label word
- dw offset dump_before ;record type 0 = BEFORE
- dw offset dump_after ;record type 1 = AFTER
- dw offset dump_fcb ;record type 2 = FCB
- dw offset dump_asciiz ;record type 3 = ASCIIZ
-
- ;***********************************************
- ;
- ; Dump BEFORE record at [SI]
- ;
- ;***********************************************
-
- dump_before proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov al,'B' ;Display "B" for BEFORE
- call print
- mov al,' ' ;plus blank after
- call print
- mov ax,[si].B_ax
- call print_wordb
- mov ax,[si].B_bx
- call print_wordb
- mov ax,[si].B_cx
- call print_wordb
- mov ax,[si].B_dx
- call print_wordb
- mov ax,[si].B_es
- call print_wordb
- mov ax,[si].B_ds
- call print_wordb
- mov ax,[si].B_si
- call print_wordb
- mov ax,[si].B_di
- call print_wordb
- mov ax,[si].B_bp
- call print_wordb
- mov ax,[si].B_ss
- call print_wordb
- mov ax,[si].B_sp
- call print_wordb
- mov dx,[si].B_cs
- mov ax,[si].B_ip
- call print_seg
-
- ;
- ; Try to interpret this BEFORE record, to make reading easier
- ;
-
- call interp
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- dump_before endp
-
- ;***********************************************
- ;
- ; Dump AFTER record at [SI]
- ;
- ;***********************************************
-
- dump_after proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov al,'A' ;Display "A" for AFTER
- call print
- mov al,' ' ;plus blank after
- call print
- mov ax,[si].A_ax
- call print_wordb
- mov ax,[si].A_bx
- call print_wordb
- mov ax,[si].A_cx
- call print_wordb
- mov ax,[si].A_dx
- call print_wordb
- mov ax,[si].A_es
- call print_wordb
- mov ax,[si].A_ds
- call print_wordb
- mov ax,[si].A_si
- call print_wordb
- mov ax,[si].A_di
- call print_wordb
- mov ax,[si].A_bp
- call print_wordb
-
- ;
- ; Now expand flags byte for clarity
- ;
-
- mov dx,[si].A_flags ;hold flags in DX
- mov si,offset dump_flags ;SI = next flag's name
- mov bx,0fd5h ;mask of valid bits in flags word
- mov cx,12 ;# bits to walk through
- cld ;forward!!!
-
- dump_after2:
- test bx,1 ;is this a valid flag bit?
- jz dump_after4 ;no, move to next one
- lodsb ;yes, get next name
- test dx,1 ;is bit set?
- jnz dump_after3 ;yes, use name
- mov al,' ' ;no, use blank
-
- dump_after3:
- call print ;print flag name or space
-
- dump_after4:
- shr dx,1 ;shift flags so next flag is in bit 0
- shr bx,1 ;ditto for mask
- loop dump_after2 ;till done all 12 bits
-
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- dump_after endp
-
- dump_flags db "CPAZSTIDO"
-
-
- ;***********************************************
- ;
- ; Dump FCB record at [SI]
- ;
- ;***********************************************
-
- dump_fcb proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov al,[si].FCB_drive ;display drive # as number
- mov byte ptr fcb_drv,al
- mov dx,offset fcb_line ;and put up rest of header
- call print_edit
- add si,3 ;skip to filename field
- mov cx,8 ;max # chars to display
- cld ;forward!!!
-
- dump_fcb2:
- lodsb ;get byte of filename
- cmp al,020h ;control char or blank?
- jbe dump_fcb3b ;yes, we're done with name
- call print ;no, display char as-is
- loop dump_fcb2 ;till 8 done or early exit
- jmp short dump_fcb4
-
- dump_fcb3: ;skip over rest of filename
- lodsb
-
- dump_fcb3b:
- loop dump_fcb3
-
- dump_fcb4: ;output extension too
- mov al,'.' ;seperate it with period
- call print
- mov cx,3 ;# extension bytes to print
-
- dump_fcb5:
- lodsb ;get byte of extension
- cmp al,020h ;control char?
- jb dump_fcb6 ;yes, skip it
- call print ;no, use as-is
-
- dump_fcb6:
- loop dump_fcb5
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- dump_fcb endp
-
-
- fcb_line label byte
- db "FCB Drive:"
- db Edit_Dec8
- fcb_drv db 0
- db " Filename: "
- db Edit_End
-
- ;***********************************************
- ;
- ; Dump ASCIIZ record at [SI]
- ;
- ;***********************************************
-
- dump_asciiz proc near
- push si
- push dx
- push cx
- push bx
- push ax
- mov dx,offset asciiz_line ;put up header
- call print_line
- add si,2 ;skip to start of ASCIIZ text
- mov cx,size ASCIIZ ;max # chars to display
- sub cx,2 ;(minus 2 for header)
- cld ;forward!!!
-
- dump_asciiz5:
- lodsb ;get byte of extension
- or al,al ;NUL terminator?
- jz dump_asciiz9 ;yes, exit
- cmp al,020h ;control char?
- jb dump_asciiz6 ;yes, skip it
- call print ;no, use as-is
-
- dump_asciiz6:
- loop dump_asciiz5
-
- dump_asciiz9:
- pop ax
- pop bx
- pop cx
- pop dx
- pop si
- ret
- dump_asciiz endp
-
-
- asciiz_line label byte
- db "ASCIIZ: $"
-
-
- ;*****************************************
- ;
- ; Display what we know about ICT # AL (0-7).
- ;
- ;*****************************************
-
- ict_dump proc near
- push dx
- push bx
- push ax
-
- and ax,number_icts*2-1 ;edit ICT #
- mov bx,ax ;get ICT # times 2
- shl bx,1 ;divide by 2
- mov bx,ict_index[bx] ;[BX] --> ICT itself
-
- mov byte ptr ict_msgno,al ;insert it into message
- mov dx,offset ict_msg1 ;"ICT #n at ..."
- call print_edit
-
- mov dx,ds ;display seg:offset of ICT
- mov ax,bx
- call print_seg
-
- mov dx,offset ict_ena ;show whether enabled or disabled
- test [bx].ICT_flags,F_ENABLE
- jnz ict_dump2 ;got right message
- mov dx,offset ict_dis ;get other message
-
- ict_dump2:
- call print_line ;display "ENABLED" or "DISABLED"
-
- mov dx,offset ict_msg2 ;"INT xxH "
- call print_line
- mov al,[bx].ICT_intnum ;display interrupt #
- call print_hex
-
- mov dx,offset ict_msg3 ;"AH range ll/hh"
- call print_line
- mov al,[bx].ICT_AH_lo ;display AH range lower limit
- call print_hex
- mov al,'/' ;add seperator
- call print
- mov al,[bx].ICT_AH_hi ;display AH range upper limit
- call print_hex
-
- mov al,'*' ;display '*' if FCB/ASCIIZ set
- test [bx].ICT_flags,F_FCB
- jnz ict_dump3 ;it's set
- mov al,' ' ;not set, so use blank
-
- ict_dump3:
- call print
-
- mov dx,offset ict_msg4 ;"Exit: RET/RET2/IRET"
- call print_line
- mov al,[bx].ICT_flags ;interpret exit type
- mov dx,offset ict_exit ;get to first 6-char message
- test al,F_RET
- jz ict_dump5 ;not this one
- call print_line
-
- ict_dump5:
- add dx,6 ;up to next 6-char exit name
- test al,F_RET2
- jz ict_dump6 ;not this one
- call print_line
-
- ict_dump6:
- add dx,6 ;up to next 6-char exit name
- test al,F_IRET
- jz ict_dump7 ;not this one
- call print_line
-
- ict_dump7:
- mov dx,offset ict_msg4a ;"Hits: "
- call print_line
- mov ax,[bx].ICT_hits
- call print_dec
-
- pop ax
- pop bx
- pop dx
- ret
-
- ict_msg1 db 0dh,0ah,"ICT# ",edit_dec8
- ict_msgno db ?," ",edit_end
-
- ict_msg1a db " @ $"
- ict_msg2 db " INT $"
- ict_msg3 db "H AH:$"
- ict_msg4 db " Exit:$"
- ict_msg4a db "Hits: $"
- ict_exit db "RET $" ;6-char exit type names
- db "RET2 $"
- db "IRET $"
- ict_ena db " ENABLED $"
- ict_dis db " DISABLED$"
-
- ict_dump endp
-
-
- ;*********************************************
- ;
- ; Display all active ICT's
- ;
- ;*********************************************
-
- disp_active proc near
- push si
- push ax
- push bx
- push cx
-
- mov cx,number_icts ;Number of ICT's
- xor si,si ;start with # 0
-
- disp_active2:
- mov bx,ict_index[si] ;[BX] --> ICT
- test [bx].ICT_flags,F_ACTIVE ;Is this ICT active?
- jz disp_active5 ;no, skip it
- mov ax,si ;yes, develop ICT # 0-7
- shr ax,1 ;divide by 2
- call ict_dump ;display it
-
- disp_active5:
- add si,2 ;up to next ICT
- loop disp_active2 ;till we've done all of them
- pop cx
- pop bx
- pop ax
- pop si
- ret
- disp_active endp
-
-
- ;*****************************************
- ;
- ; call previous PrtSc routine
- ;
- ;*****************************************
-
- db "prtsc" ;eyecatcher
- prt_sc proc near
- push ax
- push es
-
- mov ax,050h ;set ES to 0050:0000
- mov es,ax ;(the print-screen control byte)
- mov byte ptr es:[0],0 ;mark us not busy now
-
- pushf
- call old_int_5
-
- mov byte ptr es:[0],1 ;mark us busy now
- pop es
- pop ax
- ret
- prt_sc endp
-
-
- code ends
- end
-
-